<template>
	<view class="pageItem">
		<view class="main">
			<view class="card">
				<view class="c_tit">{{info.title}}</view>
				<view class="c_con">
					 <u-parse :content="info.msg"></u-parse>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { mapState } from 'vuex';
	export default {
		data() {
			return {
				id : 0,
				uid : 0,
				info : {
					id : 0,
					title : '',
					msg : '',
				},
			};
		},
		computed: {
			...mapState(['hasLogin', 'userInfo'])
		},
		onLoad(opt) {
			this.id = opt.id || 0;
			if(this.hasLogin){
				this.uid = this.userInfo.id;
			}
			this.initData();
		},
		methods:{
			initData(){
				let url = this.site_url + 'api/index/msg_detail?id='+this.id+'&uid='+this.uid;
				this.areq(url).then(res=>{
					if(res.code == 1){
						this.info  = res.data;
						if(this.uid > 0){
							uni.$emit('my_read',this.id)
						}
						
					}
					
				})
				
			}
			
		}
	}
</script>

<style lang="scss">
.main{
	width: 100%;
	padding: 4vw 4% 0;
	.card{
		@include card_style();
		padding: 5vw 4vw;
		.c_tit{
			font-size: 5vw;
			font-weight: bold;
			text-align: center;
			color: $main_color5;
		}
		.c_con{
			width: 100%;
			padding-top: 5vw;
			font-size: 3.7vw;
			color: $main_color4;
		}
	}
}
</style>
